<script setup>
import {ElMessageBox} from 'element-plus'
import useUserStore from '@/store/user'

//退出登录
const userStore = useUserStore()
const handleLogout = () => {
  ElMessageBox.confirm('确定退出登录？', '退出登录', {type: 'warning'})
    .then(() => {
      userStore.fetchLogoutAction()
    })
    .catch(() => {
    })
}

//聊天界面
const emit = defineEmits(['chat'])
const handleChat = () => {
  emit('chat')
}
</script>

<template>
  <div class="app-header">
    <h2>漠阳优选管理端</h2>
    <div class="btns">
      <el-tooltip content="消息列表" placement="left">
        <el-button text icon="Comment" @click="handleChat"/>
      </el-tooltip>
      <el-tooltip content="退出登录">
        <el-button text icon="Avatar" @click="handleLogout"/>
      </el-tooltip>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.app-header {
  @include flex-box;
  justify-content: space-between;
}

.el-button {
  font-size: $font-size-1;
  margin: 0;
}
</style>
